package com.bing.util;

import com.bing.sina.TaoListener;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Administrator on 2014/7/2.
 */

@Component
public class Context {

    public static final String Search_WeiBo = "http://s.weibo.com/wb/%1$s&xsort=time&timescope=custom:%2$tF:%2$tF&Refer=g";

    public static final String PRE_WEIBO = "http://weibo.com/";
    public static final String GONEXT = "goNext";
    public static final String WEIBOID = "weiBoId";
    public static final String JUBAOREN_URL = "juBaoRenUrl";
    public static final String BEI_JUBAO_URL = "beiJuBaoUrl";
    public static final String FENLEI = "sina.fenlei";
    public static final String GEREN_INFO_URL = "/info?from=page_100505&mod=TAB#place";
    public static final String PRE_TITLE = "pre_title";
    public static final String W_LOGIN = "login_window";
    public static final String GETWEIBOFAILED = "get weibo failed";
    public static final String LOGIN_FAILED = "login failed";
    public static final String FORCE_UPDATE = "force_update";
    public static String BROWSE_MUBIAO = "browse.mubiao";
    public static String BROWSE_OTHER_SHU = "browseOther.shu";
    public static final String COMPLAINT = "current_complaint";
    public static final String GetFOLLOWFAILED = "get followed failed";

    private String key;
    private String id;
    private String userName;
    private String passWord;
    private WebDriver driver;
    private WebDriverWait wait;
    private TaoListener taoListener;
    private Map<String, Object> settings = new HashMap<String, Object>();

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getId() {
        return id;
    }

    public void setTaoListener(TaoListener taoListener) {
        this.taoListener = taoListener;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public WebDriver getDriver() {
        return driver;
    }

    public void setDriver(WebDriver driver) {
        this.driver = driver;
    }

    public WebDriverWait getWait() {
        return wait;
    }

    public void setWait(WebDriverWait wait) {
        this.wait = wait;
    }

    public Map<String, Object> getSettings() {
        return settings;
    }

    public void setSettings(Map<String, Object> settings) {
        this.settings = settings;
    }

    public TaoListener getTaoListener() {
        return taoListener;
    }

    public void setSetting(String key, Object value) {
        settings.put(key, value);
    }

    public Object getSetting(String key) {
        if (settings.containsKey(key)) {
            return settings.get(key);
        } else {
            return null;
        }
    }

    public void removeSetting(String key) {
        settings.remove(key);
    }
}
